package com.snowy.hidden.constant;

import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 *故障设备
 * </p>
 *
 * @author：Lei.y
 * @date：2022/5/11 15:42
 */
@Getter
public enum FaultDeviceEnum {
    dg("1","电杆基础"),
    gt("2","杆塔本体"),
    lx("3","拉线"),
    hd("4","横担"),
    fzc("5","防震锤"),
    qtjs("6","其他金具"),
    xp("7","瓷式悬瓶"),
    zp("8","瓷式针瓶"),
    fhxp("9","复合式悬瓶"),
    fhzp("10","复合式针瓶"),

    qypl("11","氧化氢避雷器"),
    jxpl("12","间隙式避雷器"),
    dlpl("13","跌落式避雷器"),
    xg("14","真空开关"),
    gl("15","隔离刀闸"),
    dl("16","跌落式熔断器"),
    gd("17","户外电缆"),
    hx("18","户内电缆"),
    jl("19","进线柜避雷器"),
    zl("20","站内开关"),
    zs("21","指示灯"),
    bm("22","表计"),
    gj("23","高压熔断器"),
    gy("24","高压互感器"),
    zh("25","综合保护器"),
    by("26","变压器"),
    sh("27","无设备损坏"),
    ;

    private String code;
    private String desc;

    FaultDeviceEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过code获取枚举
     *
     * @param code
     * @return
     */
    public static FaultDeviceEnum getEnum(String code) {
        return Arrays.stream(FaultDeviceEnum.values()).filter(item -> item.getCode().equals(code)).findFirst().get();
    }
}
